{% import 'admin/layout.html' as layout with context -%}
{% import 'admin/static.html' as admin_static with context %}
<!DOCTYPE html>
<html>
  <head>
    <title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock %}</title>
    {% block head_meta %}
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
    {% endblock %}
    {% block head_css %}
        <link href="{{ admin_static.url(filename='bootstrap/bootstrap3/css/bootstrap.min.css', v='3.3.5') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css', v='1.1.1') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/css/metisMenu.min.css') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/css/sb-admin-2.css') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/css/article.css') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/css/admin.css') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/font-awesome/css/font-awesome.min.css') }}" rel="stylesheet">
        <link href="{{ admin_static.url(filename='chiki/wangEditor/css/wangEditor-1.3.12.css') }}" rel="stylesheet">
        <script src="{{ admin_static.url(filename='chiki/js/area.js') }}" type="text/javascript"></script>
        <script src="{{ admin_static.url(filename='vendor/jquery.min.js', v='2.1.4') }}" type="text/javascript"></script>
        <style>
        body {
            padding-top: 4px;
        }
        </style>
    {% endblock %}
    {% block head %}
    {% endblock %}
    {% block head_tail %}
    {% endblock %}
  </head>
  <body>
    {% block page_body %}
    <div class="{{ 'wrapper sm' if request.cookies.get('sidebar.sm') == 'true' else 'wrapper' }}">
      <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="margin-bottom: 0">
      	<!-- Brand and toggle get grouped for better mobile display -->
      	<div class="navbar-header">
      	  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#admin-navbar-collapse">
      	    <span class="sr-only">Toggle navigation</span>
      	    <span class="icon-bar"></span>
      	    <span class="icon-bar"></span>
      	    <span class="icon-bar"></span>
      	  </button>
      	  {% block brand %}
      	  <a class="navbar-brand" href="/admin/">{{ admin_view.admin.name }}</a>
      	  {% endblock %}
      	</div>
      	<!-- navbar content -->

        <div class="nav-menu-bar">
          <div class="container">
            {% block nav_menu_bar %}{% endblock %}
          </div>
        </div>

        <div class="navbar-default sidebar nicescroll" role="navigation">
          <div class="sidebar-nav navbar-collapse" id="admin-navbar-collapse">
            {% block main_menu %}
            <ul class="nav" id="side-menu">
              {{ layout.menu() }}
            </ul>
            {% endblock %}

            <ul class="nav side-toggle">
              <li>
                <a class="text-center" href="javascript:;">
                  {% if request.cookies.get('sidebar.sm') == 'true' %}
                  <i class="glyphicon glyphicon-chevron-right"></i>
                  {% else %}
                  <i class="glyphicon glyphicon-chevron-left"></i>
                  {% endif %}
                </a>
              </li>
            </ul>

            {% block menu_links %}
            <ul class="nav navbar-nav navbar-right">
              {{ layout.menu_links() }}
            </ul>
            {% endblock %}

            {% block access_control %}
            {% endblock %}
          </div>
        </div>
      </nav>

      {% block sidebar_right %}{% endblock %}
      
      <div id="page-wrapper" class="nicescroll">
        <div class="container" style="padding-bottom: 66px;">
          {% block messages %}
          {{ layout.messages() }}
          {% endblock %}

          {% set render_ctx = h.resolve_ctx() %}

          {% block body %}{% endblock %}
        </div>
      </div>
      <div id="simple-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
          <div class="modal-dialog modal-lg">
              <div class="modal-content">
              </div>
          </div>
      </div>
      <script type="text/javascript">
        $("a[data-target=#simpl-modal]").click(function(ev) {
            ev.preventDefault();
            var target = $(this).attr("href");
            $("#simpl-modal .modal-content").load(target, function() { 
                $("#simpl-modal").modal("show"); 
            });
        });
      </script>
    </div>
    {% endblock %}

    {% block tail_js %}
    <script src="{{ admin_static.url(filename='bootstrap/bootstrap3/js/bootstrap.min.js', v='3.3.5') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='vendor/moment.min.js', v='2.9.0') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='3.5.2') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/jquery.tmpl.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/jquery.nicescroll.min.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/metisMenu.min.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/sb-admin-2.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/highcharts/highcharts.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/js/highcharts/modules/exporting.js') }}" type="text/javascript"></script>
    <script src="{{ admin_static.url(filename='chiki/wangEditor/js/wangEditor-1.3.12.js') }}" type="text/javascript"></script>
    {% endblock %}

    {% block tail %}
    {% endblock %}
  </body>
</html>
